module ringcouter(
                 output  [3:0]   cnt_o,
                 output          q0_o,
                 output          q1_o,
                 output          q2_o,
                 output          q3_o,
                 input           clk,
                 input           rstn,
                 input           en_i
                  );
reg [3:0]  q;

always@(posedge clk,negedge rstn)
begin
    if(!rstn)
        q <= 4'b1000;
    else if(en_i) 
        q <= {q[2:0],q[3]};  //环形计数器
end

assign cnt_o = q;

//顺序脉冲输出
assign q0_o = q[0];
assign q1_o = q[1];
assign q2_o = q[2];
assign q3_o = q[3];

endmodule


